
package guoan.service;

import guoan.domain.ExamItemStatus;
import guoan.repository.ExamItemStatusRepository;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ExamItemStatusService {
    protected final Logger log = LoggerFactory.getLogger(getClass());

    @Autowired
    private ExamItemStatusRepository examItemStatusRepository;

    /**
     * create:批量保存预约时间表. <br/>
     *
     * @author he.sun
     * @param examItemStatusList
     */
    public void create(List<ExamItemStatus> examItemStatusList){
        // TODO Auto-generated method stub
        examItemStatusRepository.save(examItemStatusList);
    }

    /**
     * findByExamIdAndOpenHours:根据预约考试ID以及考试开放时间查找预约状态. <br/>
     *
     * @author he.sun
     * @param examId
     * @param openHours
     * @return
     */
    public ExamItemStatus findByExamIdAndOpenHours(Long examId, Long openHours){
        // TODO Auto-generated method stub
        return examItemStatusRepository.findByExamIdAndOpenHours(examId, openHours);
    }

    public ExamItemStatus saveOrUpdate(ExamItemStatus examItemStatus){
        // TODO Auto-generated method stub
        return examItemStatusRepository.save(examItemStatus);
    }

    public ExamItemStatus findOne(Long examItemStatusId){
        // TODO Auto-generated method stub
        return examItemStatusRepository.findOne(examItemStatusId);
    }

    public void deleteByExamId(Long id){
        // TODO Auto-generated method stub
        examItemStatusRepository.deleteByExamId(id);
    }

	public int updateAppNum(Long examId, Long openHours) {
		// TODO Auto-generated method stub
		return examItemStatusRepository.updateAppNum(examId,openHours);
	}

}
